package com.dcits.iweibo.monitor;

import org.jasypt.encryption.StringEncryptor;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class CommonEncryptor {
    @Autowired
    StringEncryptor stringEncryptor;

    /**
     * 测试加密，需要配置
     * jasypt:
     *   encryptor:
     *     # 加密盐值
     *     password: iweibo
     */
    @Test
    public void encrypt() {
        System.out.println("加密后密码: " + stringEncryptor.encrypt("2234"));
    }

    @Test
    public void decrypt() {
        System.out.println("解密后密码: " + stringEncryptor.decrypt("SdbQoquD6Dis5FXuBcCLIA=="));
    }
}
